/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.webhomesites.locacao.model;

import br.com.webhomesites.padrao.utils.AbstractEntity;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author Webhome
 */
@Entity
@Table(name="locmanutencao")
@NamedQueries({
@NamedQuery(name="br.com.webhomesites.locacao.model.ManutencaoModel.findMaxId", query ="SELECT MAX(id) from ManutencaoModel p"),
@NamedQuery(name="ManutencaoModel.findNomeEmpresaManutencaoByIdManutencao", query ="SELECT c.nome FROM ManutencaoModel l, EmpresaManutencaoModel c WHERE c.id = l.id and l.id = :codigo"),
@NamedQuery(name="ManutencaoModel.findByNomeEmpresaManutencao", query ="SELECT m FROM ManutencaoModel m, EmpresaManutencaoModel e WHERE m.empresaManutencaoModel.id = e.id and e.nome = :nomeEmpresaManutencao"),
@NamedQuery(name="ManutencaoModel.findByIntervaloData", query ="SELECT m FROM ManutencaoModel m where dataSaidaManutencao >= :datai and dataSaidaManutencao <= :dataf")
})
public class ManutencaoModel extends AbstractEntity implements Serializable {
    
    private List<ItemManutencaoModel> itemManutencaoModel;
    
        //private long codigoCliente;
        private String nomeEmpresaManutencao;
        private Date dataSaidaManutencao;
        private Date dataPrevDevolucao;
        private Date dataDevolucao;
        private String status;
        private Double valorTotal;
        private Double desconto;
        private Double valorPagar;    
    
    private EmpresaManutencaoModel empresaManutencaoModel;

    @ManyToOne
    @JoinColumn(name="codempresaManutencao", referencedColumnName="codigo")
    public EmpresaManutencaoModel getEmpresaManutencaoModel() {
        return empresaManutencaoModel;
    }

    public void setEmpresaManutencaoModel(EmpresaManutencaoModel empresaManutencaoModel) {
        this.empresaManutencaoModel = empresaManutencaoModel;
    }

    public void setNomeEmpresaManutencao(String nomeEmpresaManutencao) {
        this.nomeEmpresaManutencao = nomeEmpresaManutencao;
    }
           
    @Transient
    public String getnomeEmpresaManutencao() {
        return this.nomeEmpresaManutencao;
    }

    @Column(name="dataDevolucao")
    @Temporal(javax.persistence.TemporalType.DATE)
        public Date getDataDevolucao() {
        return dataDevolucao;
    }

    public void setDataDevolucao(Date dataDevolucao) {
        this.dataDevolucao = dataDevolucao;
    }

    @Column(name="dataPrevDevolucao")
    @Temporal(javax.persistence.TemporalType.DATE)
        public Date getDataPrevDevolucao() {
        return dataPrevDevolucao;
    }

    public void setDataPrevDevolucao(Date dataPrevDevolucao) {
        this.dataPrevDevolucao = dataPrevDevolucao;
    }

    @Column(name="statusl")
    public String getStatus() {
        return status;
    }

    public void setStatus(String statusLocacao) {
        this.status = statusLocacao;
    }

    @Column(name="vlrtotal")
    public double getValorTotal() {
        return valorTotal;
    }

    public void setValorTotal(double valorTotalLocacao) {
        this.valorTotal = valorTotalLocacao;
    }

    @OneToMany(mappedBy = "manutencaoModel")
    public List<ItemManutencaoModel> getItemManutencaoModel() {
        return itemManutencaoModel;
    }

    public void setItemManutencaoModel(List<ItemManutencaoModel> itemManutencaoModel) {
        this.itemManutencaoModel = itemManutencaoModel;
    }
    @Column(name="vlrdesconto", nullable=true)
    public Double getDesconto() {
        return desconto;
    }

    public void setDesconto(Double desconto) {
        this.desconto = desconto;
    }
    
    @Column(name="vlrpago", nullable=true)
    public Double getValorPagar() {
        return valorPagar;
    }

    @Column(name="datasaidamenutencao", nullable=true)
    @Temporal(javax.persistence.TemporalType.DATE)
    public Date getDataSaidaManutencao() {
        return dataSaidaManutencao;
    }

    public void setDataSaidaManutencao(Date dataSaidaManutencao) {
        this.dataSaidaManutencao = dataSaidaManutencao;
    }

    public void setValorTotal(Double valorTotal) {
        this.valorTotal = valorTotal;
    }    

    public void setValorPagar(Double valorPagar) {
        this.valorPagar = valorPagar;
    }
    
}
